require "active_record"
#require 'json'
class ActiveRecord::Base
#  before_create :create_user_set
#  before_update :update_user_set
#
  def to_json(*a)
#    result = {"Result" => self.attributes }
#p self.attributes
#    result.to_json
    self.attributes_before_type_cast.to_json
  end
  
#  def create_user_set
#    if session.nil?
#      user_id = 9999
#    elsif  session['user'].nil?
#      user_id = 9999
#    else
#      user_id = session['user']['id']
#    end
#
#    if self.attributes.has_key?("create_user_id")
#      self.create_user_id ||= user_id
#    end
#    
#    if self.attributes.has_key?("update_user_id")
#      self.update_user_id ||= user_id
#    end
#      
#  end

#  def update_user_set
#    if session.nil?
#      user_id = 9999
#    elsif  session['user'].nil?
#      user_id = 9999
#    else
#      user_id = session['user']['id']
#    end
#
#    if self.attributes.has_key?("update_user_id")
#      self.update_user_id ||= user_id
#    end
#      
#  end
end
